﻿using System;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;
using OmegaEngine;

namespace OmegaEngine
{
    public class GUILabelInput : GUIActor
    {
        public enum Orientation { Left, Top, Right, Bottom };

        string text { get; set; }
        GUIBackgroundButton checkBox;
        GUILabel label;
        Orientation labelOrientation = Orientation.Right;
        bool isChecked;
        Texture2D textureChecked = Engine.Content.Load<Texture2D>("Content/check-checked");
        Texture2D textureUnchecked = Engine.Content.Load<Texture2D>("Content/check-unchecked");

        public GUILabelInput(string Text, int PositionX, int PositionY, int Width, int Height, Color Color, GameScreen Parent)
            : base()
        {
            this.setupLabel(Text, Engine.DefaultFont, (PositionX + Width + 10), (PositionY - 2), Color, Parent);
            this.setupCheck(PositionX, PositionY, Width, Height, Color, Parent);
        }

        public void setupLabel(string Label, SpriteFont Font, int PositionX, int PositionY, Color Color, GameScreen Parent)
        {
            this.label = new GUILabel(Label, Font, PositionX, PositionY, Color, Parent);
        }

        public void setupCheck(int PositionX, int PositionY, int Width, int Height, Color Color, GameScreen Parent)
        {
            this.checkBox = new GUIBackgroundButton(this.textureUnchecked,
                this.toggleCheck,
                PositionX, PositionY,
                Width, Height,
                Color, Parent); // Change position, etc as needed
        }

        public void toggleCheck()
        {
            this.isChecked = !this.isChecked;

            if (this.isChecked)
                this.checkBox.UpdateTexture(this.textureChecked);
            else
                this.checkBox.UpdateTexture(this.textureUnchecked);
        }

        public override void Draw()
        {
            base.Draw();
        }
    }
}
